package com.example.medicalrecord.AggregationModule.doctor.controller;

import com.example.medicalrecord.AggregationModule.doctor.pojo.dto.DoctorQuery;
import com.example.medicalrecord.AggregationModule.doctor.pojo.dto.PatientQuery;
import com.example.medicalrecord.AggregationModule.doctor.pojo.vo.DoctorVO;
import com.example.medicalrecord.AggregationModule.doctor.service.DoctorService;
import com.example.medicalrecord.base.response.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/v1/doctor")
public class DoctorController {
    @Autowired
    DoctorService doctorService;

    @GetMapping("select")
    public JsonResult selectPatient(PatientQuery patientQuery){
        log.debug("查询患者：patientQuery={}",patientQuery);
        List<DoctorVO> list = doctorService.selectPatient(patientQuery);
        return JsonResult.ok(list);
    }
    @GetMapping("savePatient")
    public JsonResult savePatient(DoctorQuery doctorQuery){
        log.debug("保存患者：doctorVO={}",doctorQuery);
         doctorService.savePatient(doctorQuery);
         return JsonResult.ok();
    }
}
